function handles = loadParameter(paramStr, handles)
% loadParameter
%
% editing:
% gs july 2006
% ---------------------------------------------------

% get name of group
s = get(handles.groupList, 'String');
v = get(handles.groupList, 'Value');
groupName = s{v};

% get list of names of cells/expts
listOfCells = get(handles.cellList, 'String');

% main loading loop
numCells = size(listOfCells, 1);
for n = 1 : numCells
    
    % load the cells' data
    cellA = eval([listOfCells{n}]);     % load the cell/expt data
    
    % retrieve value
    if isfield(cellA, paramStr)
        if isempty(eval(['cellA.' paramStr]))
            paramVal(n) = NaN;
            disp(['Warning: empty parameter value found for: ' listOfCells{n}]);
        else
            paramVal(n) = eval(['cellA.' paramStr]);
        end
    else
        paramVal(n) = NaN;
        disp(['Warning: field missing for: ' listOfCells{n}]);
    end
    
end

handles.analysis.mapAverager.currentParameterName = paramStr;
handles.analysis.mapAverager.currentParameterVal = paramVal;
